﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using Shove.Web.UI;

public partial class UserControls_GoodConsultDetails :UCBase 
{
    public UserControls_GoodConsultDetails()
    {
        Name = "商品咨询详细";

        swpas = new ShoveWebPartAttribute[11];

        swpas[0] = new ShoveWebPartAttribute_Int("控件宽度", "1,1004", 759, "控件宽度");
        swpas[1] = new ShoveWebPartAttribute_Int("导航单元格高度", "1,500", 23, "导航单元格高度");
        swpas[2] = new ShoveWebPartAttribute_Int("导航单元格宽度", "1,600", 104, "导航单元格宽度");
        swpas[3] = new ShoveWebPartAttribute_Int("标题行高", "1,200", 25, "标题行高");
     
        swpas[4] = new ShoveWebPartAttribute_Color("控件边框颜色", "#E7C890", "控件边框颜色");

        swpas[5] = new ShoveWebPartAttribute_Image("标题行背景图片", "", "images/UserControls/category_bg_1.jpg", "标题行背景图片");
        swpas[6] = new ShoveWebPartAttribute_Image("导航背景图片1", "", "images/UserControls/title_bg_1.jpg", "导航背景图片1");
        swpas[7] = new ShoveWebPartAttribute_Image("导航背景图片2", "", "images/UserControls/title_bg_hui.jpg", "导航背景图片2");

        swpas[8] = new ShoveWebPartAttribute_Text("导航文本样式", "", "title14_bai", "导航文本样式");
        swpas[9] = new ShoveWebPartAttribute_Text("标题样式", "", "td14", "标题样式");
        swpas[10] = new ShoveWebPartAttribute_Text("控件文本内容CSS样式", "", "black12", "控件文本内容CSS样式");
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        Initlayout();
        LoadData();
    }

    private void LoadData()
    { 
        DataTable dt = new DAL.Tables.tbl_Site_GoodComment().Open("", "ID=" + Shove._Convert.StrToLong(Shove._Web.Utility.GetRequest("ID"), 0).ToString(), "");

        if(dt!=null && dt.Rows.Count>0)
        {
            lbTitle.Text =dt.Rows[0]["Title"].ToString();

            if (dt.Rows[0]["ReplyDate"].ToString() != "")
            {
                lbReplyDate.Text = "商店于" + dt.Rows[0]["ReplyDate"].ToString() + "回复";
            }
            else
            {
                lbReplyDate.Text = "商店暂未回复";
            }

            if (dt.Rows[0]["ReplyContent"].ToString() == "")
            {
                lbReplyContent.Visible = false;
            }
            else
            {
                lbReplyContent.Text = dt.Rows[0]["ReplyContent"].ToString();
            }

            lbIssueDate.Text = dt.Rows[0]["CreateDate"].ToString();
            lbIssueContent.Text = dt.Rows[0]["Content"].ToString();   
        }
    }

    private void Initlayout()
    {
        tabctr.Width = swpAttributes[0];
        tabctr.BgColor = swpAttributes[4];

        tdsign.Width = swpAttributes[2];
        tdsign.Height = swpAttributes[1];
        tdsign.Style.Add("background-image", "url('" + swpAttributes[6] + "')");
        tdsign.Attributes.Add("class", swpAttributes[8]);

        tdspace.Style.Add("background-image", "url('" + swpAttributes[7] + "')");

        tab1.Attributes.Add("class", swpAttributes[10]);
        tdtitle.Height = swpAttributes[3];
        tdtitle.Attributes.Add("class", swpAttributes[9]);
        tdtitle.Style.Add("background-image", "url('" + swpAttributes[5] + "')");
    }
}
